package com.iss.okair.db.mapper.sql;

import com.iss.okair.db.entity.Sysuser;
import org.apache.ibatis.jdbc.SQL;

public class SysuserSQL {
    //动态查询语句
    public String findUser(Sysuser example){

        return new SQL(){
            {
                SELECT("id,uid,pwd");
                SELECT("nickname,role,createtime");
                FROM("sysuser");
                if(example.getUid()!=null){
                    WHERE("uid like '%"+example.getUid()+"%'");
                }
                if(!"-1".equals(example.getRole())){
                    WHERE("role =#{role}");
                }

            }

        }.toString();

    }

}
